import http from "./http";
// 用于管理整个项目的所有接口
// 首页轮播图
export const asideApi = (params) => http.get("/home/banner", params);
// 首页推荐
export const recommendApi = (params) => http.post("/home/recommend", params);
// 分类数据
export const classifyApi = (data) => http.post("/classify", data);
// 详情页数据
export const detailApi = (data) => http.post("/detail", data);
// // 获取短信验证码
// export const messageApi = (tel) =>
//     http.post("/register/getCode", { phone: tel + "", templateId: "537707" });
// // 注册或登录
// export const resetApi = (data) =>
//     http.post("/register", { phone: data.phone, code: data.code });
// // 获得个人信息
// export const userGetApi = (data) => http.post("/userinfo/get", data);

// 修改个人信息
export const userUpdateApi = (data) =>
  http.post("/userinfo/update", {
    token: data.token,
    nickName: data.name,
    sex: data.sex,
  });

// 获取收货地址

export const addressGetApi = (token) =>
  http.post("/address/get", { token: token });
// 新增收货地址

export const addressAddApi = (data) =>
  http.post("/address/add", {
    token: data.token,
    getName: data.name,
    getPhone: data.phone,
    address: data.address,
    status: data.status,
  });
// 修改收货地址
export const addressUpdateApi = (data) => http.post("/address/update", data);
// 获取购物车列表
export const cartGetApi = (data) => http.post("/cart/get", data);
// 加入购物车
export const cartAddApi = (data) => http.post("/cart/add", data);

// 验证码接口
export const messageApi = (tel) =>
  http.post("/register/getCode", { phone: tel + "", templateId: "537707" });
// 登录验证接口
export const resetApi = (data) =>
  http.post("/register", { phone: data.phone, code: data.code });
// 获取个人信息接口
export const userInfoApi = (token) =>
  http.post("/userinfo/get", { token: token });
